<template>
	<view class="container">
		<fu-navbar title="备件审核" bgColor="#0f68f0" color="#fff" isBackText></fu-navbar>
		<view class="bg-f padding-lr-24" style="border-radius: 0 0 20rpx 20rpx;">
			<view class="flex align-center padding-tb-32 border-b-c9">
				<image src="../../../static/images/icon31.png" mode="widthFix" class="i-icon margin-r-24"></image>
				<text class="fs-32 text-bold">基本信息</text>
			</view>
			<!-- <view class="flex align-center padding-tb-32 border-b-e4 justify-between fs-28">
				<view>仓库</view>
				<view class="flex align-center">
					<text>仓库1</text>
				</view>
			</view> -->
			<view class="flex align-center padding-tb-32 border-b-e4 justify-between fs-28">
				<view>出库类型</view>
				<view class="flex align-center">
					<text class="text-ellipsis">{{info.outType == 4 ? '维修出库' : info.outType == 5 ? '维保出库' : info.outType == 6 ? '盘亏出库' : '自主出库'}}</text>
				</view>
			</view>
			<view class="flex align-center padding-tb-32 border-b-e4 justify-between fs-28" v-if="info.businessCode">
				<view>关联单据</view>
				<view class="flex align-center maxW-68">
					<view class="text-ellipsis text-underline" style="color: #02A7F0;">
						{{info.businessCode}}
					</view>
				</view>
			</view>
			<view class="flex padding-tb-32 border-b-e4 justify-between fs-28">
				<view class="flex-shrink">申请说明</view>
				<textarea placeholder="点击输入多行文本" placeholder-class="pla-tra" class="tra maxW-68" disabled v-model="info.applyDesc"></textarea>
			</view>
		</view>
		<view class="margin-t-32 bg-f padding-lr-24" style="border-radius: 20rpx 20rpx 0 0;">
			<view class="flex align-center padding-tb-32 border-b-c9 justify-between">
				<view class="flex align-center">
					<image src="../../../static/images/icon32.png" mode="widthFix" class="margin-r-24" style="width: 60rpx;"></image>
					<text class="fs-32 text-bold">备件列表</text>
				</view>
			</view>
			<view class="padding-tb-12">
				<view class="item padding-tb-12" v-for="(item, index) in info.partList" :key="index">
					<view class="flex align-center justify-between over-hidden">
						<view class="fs-30 text-bold text-ellipsis">{{item.name}}</view>
						<view class="fs-30">当前库存：{{item.stock}}</view>
					</view>
					<view class="flex over-hidden margin-t-24">
						<image src="../../../static/images/no-img.png" class="img flex-shrink" mode="aspectFill"></image>
						<view class="flex-1 over-hidden">
							<view class="fs-26 flex">
								<view class="label">编码：</view>
								<view class="text-ellipsis">{{item.code}}</view>
							</view>
							<view class="fs-26 flex">
								<view class="label">分类：</view>
								<view class="text-ellipsis">{{item.brand}}</view>
							</view>
							<view class="fs-26 flex">
								<view class="label">规格型号：</view>
								<view class="text-ellipsis">{{item.specs}}</view>
							</view>
							<!-- <view class="flex over-hidden fs-26">
								<view class="label flex-shrink">仓库：</view>
								<view class="flex-1 text-ellipsis">{{item.warehouse || ''}}</view>
							</view> -->
							<!-- <view class="fs-26 flex">
								<view class="label">库位：</view>
								<view class="text-ellipsis">{{item.locator || ''}}</view>
							</view> -->
						</view>
						<view class="flex-shrink flex align-end margin-b-12">
							<view class="flex align-center">
								<image src="../../../static/images/jian.png" class="icon"></image>
								<view class="num">{{item.num}}</view>
								<image src="../../../static/images/jia.png" class="icon"></image>
							</view>
						</view>
					</view>
				</view>
			</view>
			<view class="flex justify-center align-center" style="height: 200rpx;" v-if="info.partList&&info.partList.length == 0">
				<image src="../../../static/empty/no-data.png" mode="widthFix" style="width: 160rpx;"></image>
			</view>
		</view>
		<view class="bottom-wrap" v-if="info.state == 1">
			<view class="bottom flex align-center justify-between fs-36">
				<view class="btn bg-red" @click="navTo(`/pages/service/accept/index?type=2&orderType=part&title=备件审核&orderId=${id}`)">审核驳回</view>
				<view class="btn" @click="navTo(`/pages/service/accept/index?type=1&orderType=part&title=备件审核&orderId=${id}`)">审核通过</view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			id: null,
			info: {}
		}
	},
	onLoad(option) {
		this.id = option.id || null
		this.getDetail();
	},
	methods: {
		navTo(path) {
			uni.navigateTo({
				url:path
			})
		},
		getDetail() {
			this.$api.post(global.apiUrls.selectPartApplyOne, {
				id: this.id
			}).then(res => {
				if (res.data.code == 9100) {
					this.info = res.data.info
				} else {
					uni.showToast({
						title: res.data.msg,
						icon: 'none'
					})
				}
			})
		}
	}
}
</script>

<style lang="scss" scoped>
.container {
	min-height: 100vh;
	background-color: #f3f5f8;
}
.i-icon {
	width: 40rpx;
}
.pla-tra {
	color: #ccc;
}
.tra {
	height: 160rpx;
	font-size: 28rpx;
}
.maxW-68 {
	max-width: 68%;
}
.item {
	.label {
		width: 136rpx;
		text-align: right;
		flex-shrink: 0;
	}
	.img {
		width: 120rpx;
		height: 120rpx;
		margin-right: 12rpx;
	}
	.icon {
		width: 32rpx;
		height: 32rpx;
	}
	.num {
		width: 70rpx;
		border: 1rpx solid #b4b4b4;
		margin: 0 12rpx;
		font-size: 26rpx;
		text-align: center;
	}
}
.bottom-wrap {
	height: 140rpx;
	.bottom {
		padding: 16rpx 48rpx;
		position: fixed;
		bottom: 0;
		width: 100%;
		box-sizing: border-box;
		z-index: 9;
		.btn {
			width: 45%;
			height: 98rpx;
			border-radius: 12rpx;
			text-align: center;
			line-height: 98rpx;
			color: #fff;
			background-color: #0f68f0;
		}
		.bg-red {
			background-color: #e57a87;
		}
	}
}
</style>